Skip to content

Add benchmark suite and request timing#1

Merged
cmyui merged 1 commit intochess-appfrom
benchmarks
Feb 7, 2026
Merged

Add benchmark suite and request timing#1
cmyui merged 1 commit intochess-appfrom
benchmarks

Conversation

@cmyui
Copy link
Copy Markdown
Owner

@cmyui cmyui commented Feb 6, 2026

Summary

  • Add make bench target with 13 microbenchmarks across 5 subsystems (slab allocator, database, string utilities, JSON builder, HTTP request parsing)
  • Add ARM64 Generic Timer driver (timer_read, timer_freq) using cntpct_el0/cntfrq_el0
  • Add per-request timing instrumentation in slowapi_handle — logs nanosecond wall-clock time to UART for every HTTP request

Sample output

========== RUNNING BENCHMARKS ==========

--- slab allocator ---
mem_alloc            | 1000 iters | min: 0 (0 ns) | avg: 36 (576 ns) | max: 7125 (114000 ns)
mem_free             | 1000 iters | min: 0 (0 ns) | avg: 29 (464 ns) | max: 625 (10000 ns)
alloc_free_cycle     | 1000 iters | min: 0 (0 ns) | avg: 39 (624 ns) | max: 2438 (39008 ns)

--- database ---
db_create            |  500 iters | min: 0 (0 ns) | avg: 62 (992 ns) | max: 10812 (172992 ns)
db_get               | 1000 iters | min: 0 (0 ns) | avg: 12 (192 ns) | max: 3438 (55008 ns)

--- request parsing ---
parse_request        |  500 iters | min: 0 (0 ns) | avg: 94 (1504 ns) | max: 14437 (230992 ns)

Live request timing:

[SlowAPI] request handled in 582000 ns
[SlowAPI] request handled in 70000 ns

Test plan

  • make — server builds clean
  • make test — all 60 tests pass
  • make bench — 13 benchmarks run with timing data
  • make run + curl — request timing prints to UART

🤖 Generated with Claude Code

Benchmark suite (make bench) measures operation latencies across all
major subsystems: slab allocator, database, string utilities, JSON
builder, and HTTP request parsing. Uses ARM64 Generic Timer for
nanosecond-precision measurements.

Request timing logs wall-clock time for every HTTP request handled
by slowapi_handle, printed to UART on completion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cmyui cmyui changed the title benchmark suite v1 Add benchmark suite and request timing Feb 7, 2026
@cmyui cmyui merged commit 180e69a into chess-app Feb 7, 2026
@cmyui cmyui deleted the benchmarks branch February 7, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant